<?
var method = docfiles[0]

if (method.hasDocusaurusHeader) {
?>---
id: <?= method.command ?>
title: <?= method.command ?>
<? if (method.customEditUrl) { ?>custom_edit_url: <?= method.customEditUrl ?><? } ?>
---
<? } else if (method.hasHeader) { ?>
## <?= method.command ?>
<? } ?>

<?- method.description ?>

##### Usage

```js
<? if (method.isElementScope) {
?>$(selector).<?= method.command ?>(<?= method.paramString ?>)<? } else if (method.isMockScope) {
?>mock.<?= method.command ?>(<?= method.paramString ?>)<? } else {
?><?= method.isMobile ? 'driver' : 'browser' ?>.<?= method.command ?>(<?= method.paramString ?>)<? } ?>
```

<? if (method.paramTags.length) { ?>
##### Parameters

| Name | Type | Details |
| ---- | ---- | ------- |
<? method.paramTags.forEach((paramTag) => {
    var paramKey = paramTag.types
        ? paramTag.types.map((type) => `<code>${type.replace(/>/g, "&gt;").replace(/</g, "&lt;")}</code>`).join('|')
        : paramTag.type
    ?>| <code><var><?= paramTag.name ?></var></code><? if ((!paramTag.required && typeof paramTag.optional === 'undefined') || paramTag.optional) { ?><br><span class="label labelWarning">optional</span><? }
    ?> | <?= paramKey.split('|').join(', ').replace('(', '').replace(')', '')
    ?> | <?= paramTag.description ?> |
<? }) ?>
<? } ?>

<? if (method.examples.length) { ?>
##### Example<? if (method.examples.length > 1) { ?>s<? } ?>
<? method.examples.forEach(function(example) { ?>
```<?= example.format ?><? if (example.file) { ?> <?= example.file ?><? } ?>
<?- example.code ?>
```
<? }); ?>
<? } ?>

<? if (method.returns) { ?>
##### Returns

- **&lt;<?= method.returns.type ?>&gt; <code><var><?= method.returns.name ?></var></code>:** <?= method.returns.description ?>
<? } ?>

<? if (method.throwsTags.length) { ?>
##### Throws

<? method.throwsTags.forEach(function(throwsTag) { ?>- **<?= throwsTag.type ?>**: <?= throwsTag.description ?>
<? }) ?>
<? } ?>

<? if (method.support && Object.keys(method.support).length) { ?>
##### Support

<? Object.keys(method.support).forEach(function(platform) {
?>![Support for <?=Object.keys(method.support[platform]).map(function(driver) {
    return driver + " (" + method.support[platform][driver] + ")"
}).join(", ")?>](/img/icons/<?= platform ?>.svg)
?><? }) ?>
<? } ?>
